/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cl.bussines.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Vogel
 */
@Entity
@Table(name = "moto_prod")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MotoProd.findAll", query = "SELECT m FROM MotoProd m"),
    @NamedQuery(name = "MotoProd.findByIdMotoProd", query = "SELECT m FROM MotoProd m WHERE m.idMotoProd = :idMotoProd")})
public class MotoProd implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_Moto_Prod")
    private Integer idMotoProd;
    @JoinColumn(name = "Cod_Prod", referencedColumnName = "Cod_Prod")
    @ManyToOne(optional = false)
    private Productos codProd;
    @JoinColumn(name = "id_Moto", referencedColumnName = "id_Moto")
    @ManyToOne(optional = false)
    private Moto idMoto;

    public MotoProd() {
    }

    public MotoProd(Integer idMotoProd) {
        this.idMotoProd = idMotoProd;
    }

    public Integer getIdMotoProd() {
        return idMotoProd;
    }

    public void setIdMotoProd(Integer idMotoProd) {
        this.idMotoProd = idMotoProd;
    }

    public Productos getCodProd() {
        return codProd;
    }

    public void setCodProd(Productos codProd) {
        this.codProd = codProd;
    }

    public Moto getIdMoto() {
        return idMoto;
    }

    public void setIdMoto(Moto idMoto) {
        this.idMoto = idMoto;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMotoProd != null ? idMotoProd.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MotoProd)) {
            return false;
        }
        MotoProd other = (MotoProd) object;
        if ((this.idMotoProd == null && other.idMotoProd != null) || (this.idMotoProd != null && !this.idMotoProd.equals(other.idMotoProd))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cl.bussines.entities.MotoProd[ idMotoProd=" + idMotoProd + " ]";
    }
    
}
